import request from '@/utils/request';

/**
 * 我的车队列表
 */
export async function pageMyCompany(params) {
  const res = await request.post('/company/getMyList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车队列表
 */
export async function pageCompanyList(params) {
  const res = await request.post('/company/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 删除车队
 */
export async function delCompany(params) {
  const res = await request.post('/company/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 删除车队
 */
export async function updateCompany(params) {
  const res = await request.post('/company/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}

/**
 * 车辆状态列表
 */
export async function pageVehicleStatusList(params) {
  const res = await request.post('/vehicle_status/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}

/**
 * 区域列表
 */
export async function pageCompanyAreaList(params) {
  const res = await request.post('/company_area/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}

/**
 * 区域列表
 */
export async function pageMyCompanyArea(params) {
  const res = await request.post('/company_area/getMyList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 删除区域
 */
export async function delCompanyArea(params) {
  const res = await request.post('/company_area/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 更新区域
 */
export async function updateCompanyArea(params) {
  const res = await request.post('/company_area/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 批量导入车辆
 */
export async function importVehicleFromExcel(params) {
  const res = await request.post('/vehicle/importExcel', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 导出车辆
 */
export async function exportVehicleList(params) {
  const res = await request.post('/vehicle/exportExcel', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆列表
 */
export async function pageVehicleList(params) {
  const res = await request.post('/vehicle/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 删除车辆
 */
export async function delVehicle(params) {
  const res = await request.post('/vehicle/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆到期列表
 */
export async function pageVehicleEndList(params) {
  const res = await request.post('/vehicle/getEndList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆过期列表
 */
export async function pageVehicleExpiredList(params) {
  const res = await request.post('/vehicle/getExpiredList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 出单计划表
 */
export async function pageInsurancePlanList(params) {
  const res = await request.post('/insurance_plan/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}

/**
 * 保险公司列表
 */
export async function pageInsuranceCompanyList(params) {
  const res = await request.post('/insurance_company/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 删除保险公司
 */
export async function delInsuranceCompany(params) {
  const res = await request.post('/insurance_company/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 更新保险公司
 */
export async function updateInsuranceCompany(params) {
  const res = await request.post('/insurance_company/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}

/**
 * 保险公司销售人员列表
 */
export async function pageInsuranceCompanySalesmanList(params) {
  const res = await request.post('/insurance_company_salesman/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 删除保险公司销售人员
 */
export async function delInsuranceCompanySalesman(params) {
  const res = await request.post('/insurance_company_salesman/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 更新保险公司销售人员
 */
export async function updateInsuranceCompanySalesman(params) {
  const res = await request.post('/insurance_company_salesman/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 提交报价
 */
export async function updateInsurance(params) {
  const res = await request.post('/insurance/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 报价详情
 */
export async function pageInsurance(params) {
  const res = await request.post('/insurance/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 待付款保单
 */
export async function pageInsuranceWatingPay(params) {
  const res = await request.post('/insurance/getWatingPayList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 待上传pdf的保单
 */
export async function pageInsuranceWatingComplete(params) {
  const res = await request.post('/insurance/getWatingCompleteList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 待上传退保pdf的保单
 */
export async function pageInsuranceWatingRefundComplete(params) {
  const res = await request.post(
    '/insurance/getWatingRefundCompleteList',
    params
  );
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 报价详情里面的商业险详情列表
 */
export async function pageInsuranceDetailList(params) {
  const res = await request.post('/insurance_detail/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 出单
 */
export async function offerToBuy(params) {
  const res = await request.post('/insurance/toBuy', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 出单
 */
export async function updateInsurancePlanPdf(params) {
  const res = await request.post('/insurance_plan/updatePdf', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 创建收入
 */
export async function updateMoney(params) {
  const res = await request.post('/money/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 设置报价单状态为待内勤查看
 */
export async function setPlanToChoose(params) {
  const res = await request.post('/insurance_plan/toChoose', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 创建报价申请 //2024年09月06日 应该废了
 */
export async function createPlan(params) {
  const res = await request.post('/insurance_plan/createPlan', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 重新报价
 */
export async function reOffer(params) {
  const res = await request.post('/insurance_plan/reOffer', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 重新报价
 */
export async function setInsurancePlanStatus(params) {
  const res = await request.post('/insurance_plan/setStatus', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 修改报价申请的状态
 */
export async function offerWatingReply(params) {
  const res = await request.post('/insurance_plan/watingReply', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}

/**
 * 更新报价图片
 */
export async function updateOfferImages(params) {
  const res = await request.post('/insurance/updateImages', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 无法出单
 */
export async function offerCantbuy(params) {
  const res = await request.post('/insurance_plan/cantBuy', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 上传pdf地址
 */
export async function updateInsurancePdf(params) {
  const res = await request.post('/insurance/updatePdf', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 上传退统pdf地址
 */
export async function updateInsuranceRefundPdf(params) {
  const res = await request.post('/insurance/updateRefundPdf', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 上传二维码付款图片
 */
export async function updateInsuranceOfferQr(params) {
  const res = await request.post('/insurance/updateQrcode', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}

/**
 * 提交到付款状态
 */
export async function setTradeToPay(params) {
  const res = await request.post('/trade/toPay', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 出单
 */
export async function updateTrade(params) {
  const res = await request.post('/trade/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 待出单的出单表
 */
export async function pageWatingBuyTrades(params) {
  if (params.startDate === null) params.startDate = '';
  if (params.endDate === null) params.endDate = '';
  const res = await request.post('/trade/getWatingBuyList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 出单列表
 */
export async function pageTradeList(params) {
  if (params.startDate === null) params.startDate = '';
  if (params.endDate === null) params.endDate = '';
  const res = await request.post('/trade/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 出单列表
 */
export async function getTradeById(params) {
  const res = await request.post('/trade/getById', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 出单列表
 */
export async function pageInsuranceOffer(params) {
  const res = await request.post('/insurance/getOfferList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 出单表获取报价单列表、保险列表
 */
export async function pageTradeInsurance(params) {
  const res = await request.post('/insurance/getTradeOfferList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 出单通知里面，获取待购买的保险列表
 */
export async function pageWatingBuyInsurance(params) {
  const res = await request.post('/insurance/getWatingBuyInsurance', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 更新出单表选中保险
 */
export async function updateTradeInsurance(params) {
  const res = await request.post('/insurance/updateTradeInsurance', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 保险付款图片
 */
export async function updateOfferPayImages(params) {
  const res = await request.post('/insurance/updatePayImages', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 保险付款完毕
 */
export async function setTradeToPayDone(params) {
  const res = await request.post('/trade/payDone', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 账单主列表
 */
export async function pageBillList(params) {
  const res = await request.post('/bill/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 账单详情列表
 */
export async function pageBillDetail(params) {
  const res = await request.post('/bill_detail/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 账单还款操作
 */
export async function billRepay(params) {
  const res = await request.post('/bill/repay', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 导出账单
 */
export async function exportBillList(params) {
  const res = await request.post('/bill/export', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 导出保险过期车辆
 */
export async function exportVehicleInsuranceExpired(params) {
  const res = await request.post('/vehicle/exportExpired', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 导出保险即将过期车辆
 */
export async function exportVehicleInsuranceInTheEnd(params) {
  const res = await request.post('/vehicle/exportInTheEnd', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 付款记录
 */
export async function pagePayRecord(params) {
  const res = await request.post('/pay_record/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 待和中润结算的列表
 */
export async function pagePayToZrList(params) {
  const res = await request.post('/insurance/getZrList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 待保险返点的列表
 */
export async function pageRebateFromInsuranceList(params) {
  const res = await request.post('/insurance/getRebateList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 读取单条支付记录
 */
export async function getPayRecordById(params) {
  const res = await request.post('/pay_record/getById', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}

/**
 * 保存出单表的付款信息
 */
export async function updateTradePaid(params) {
  const res = await request.post('/trade/updateTradePaid', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 保存出单表的应付
 */
export async function updateTradePrice(params) {
  const res = await request.post('/trade/updateTradePrice', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 保存出单表的应付
 */
export async function updateTradeRemark(params) {
  const res = await request.post('/trade/updateTradeRemark', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 保存出单表的分期和垫付信息
 */
export async function updateTradeInstallment(params) {
  const res = await request.post('/trade/updateTradeInstallment', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 保存出单表的分期和垫付信息
 */
export async function updateTradeDianfu(params) {
  const res = await request.post('/trade/updateTradeDianfu', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 提交出单通知
 */
export async function tradeToBuy(params) {
  const res = await request.post('/trade/toBuy', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 提交出单通知
 */
export async function tradeToJudge(params) {
  const res = await request.post('/trade/toJudge', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 删除
 */
export async function delTrade(params) {
  const res = await request.post('/trade/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 出单通知的保险无法购买
 */
export async function tradeBuyToChoose(params) {
  const res = await request.post('/trade/toChoose', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 保存出单表的分期和垫付信息
 */
export async function getTradeInsurancePdf(params) {
  const res = await request.post('/insurance/getPdfPath', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 保险结账
 */
export async function insurancePay(params) {
  const res = await request.post('/insurance/pay', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 保险结账
 */
export async function sendTradeToWatingBuy(params) {
  const res = await request.post('/trade/backToBuy', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆添加编辑
 */
export async function updateVehicle(params) {
  const res = await request.post('/vehicle/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆保险的添加编辑
 */
export async function updateVehicleInsurance(params) {
  const res = await request.post('/vehicle/updateInsurance', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 退保
 */
export async function insuranceRefund(params) {
  const res = await request.post('/insurance_refund/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 退款列表
 */
export async function pageRefundList(params) {
  const res = await request.post('/insurance/getRefundList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 已收到退款的保费
 */
export async function updateInsuranceRefundAmount(params) {
  const res = await request.post('/insurance/refundAmountDone', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 已付退款的返点
 */
export async function updateInsuranceRefundRebate(params) {
  const res = await request.post('/insurance/refundRebateDone', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 已付退款的返点
 */
export async function pageInsuranceCate(params) {
  const res = await request.post('/insurance_cate/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 待返还列表
 */
export async function pageReturnMoney(params) {
  const res = await request.post('/return_money/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 待返还列表
 */
export async function returnMoney(params) {
  const res = await request.post('/return_money/return', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 收到保险公司的返点
 */
export async function rebatePay(params) {
  const res = await request.post('/insurance/rebatePay', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 删除保单（包含报价单都是这个接口）
 */
export async function delInsurance(params) {
  const res = await request.post('/insurance/delete', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 更新车辆图片资料
 */
export async function updateVehicleImages(params) {
  const res = await request.post('/vehicle/updateImages', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 计算分期还款方案
 */
export async function getInstallmentRepayList(params) {
  const res = await request.post('/trade/getInstallmentRepayList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆收支分类
 */
export async function updateVehicleIncomeExpenseCate(params) {
  const res = await request.post('/vehicle_income_expense_cate/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆收支分类
 */
export async function delVehicleIncomeExpenseCate(params) {
  const res = await request.post('/vehicle_income_expense_cate/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆收支分类
 */
export async function pageVehicleIncomeExpenseCate(params) {
  const res = await request.post(
    '/vehicle_income_expense_cate/getList',
    params
  );
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆收支分类
 */
export async function updateVehicleIncomeExpense(params) {
  const res = await request.post('/vehicle_income_expense/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆收支分类
 */
export async function pageVehicleIncomeExpense(params) {
  const res = await request.post('/vehicle_income_expense/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆收支分类
 */
export async function delVehicleIncomeExpense(params) {
  const res = await request.post('/vehicle_income_expense/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 作废车辆收支申请
 */
export async function invalidVehicleIncomeExpense(params) {
  const res = await request.post('/vehicle_income_expense/invalid', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆收支分类
 */
export async function vehicleIncomeExpensePay(params) {
  const res = await request.post('/vehicle_income_expense/pay', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆收支分类
 */
export async function vehicleIncomeExpenseReject(params) {
  const res = await request.post('/vehicle_income_expense/reject', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆转出
 */
export async function updateVehicleOut(params) {
  const res = await request.post('/vehicle_out/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆转出
 */
export async function pageVehicleOut(params) {
  const res = await request.post('/vehicle_out/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆转出
 */
export async function judgeVehicleOut(params) {
  const res = await request.post('/vehicle_out/judge', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆转出
 */
export async function payVehicleOut(params) {
  const res = await request.post('/vehicle_out/pay', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆转出
 */
export async function judgePayVehicleOut(params) {
  const res = await request.post('/vehicle_out/judgePay', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 车辆档案，车辆信息
 */
export async function vehicleFiles(params) {
  const res = await request.post('/vehicle/getFilesById', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 还款记录
 */
export async function pageBillRepayRecord(params) {
  const res = await request.post('/bill_repay_record/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 还款记录
 */
export async function judgeBillRepayRecord(params) {
  const res = await request.post('/bill/judge', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 利润指标
 */
export async function pageProfitTarget(params) {
  const res = await request.post('/profit_target/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 利润指标
 */
export async function updateProfitTarget(params) {
  const res = await request.post('/profit_target/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 利润指标
 */
export async function delProfitTarget(params) {
  const res = await request.post('/profit_target/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 退保
 */
export async function pageInsuranceRefund(params) {
  const res = await request.post('/insurance_refund/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 退保
 */
export async function insuranceRefundDone(params) {
  const res = await request.post('/insurance_refund/done', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 退保计划
 */
export async function pageInsuranceRefundPlan(params) {
  const res = await request.post('/insurance_refund_plan/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 退保计划
 */
export async function updateInsuranceRefundPlan(params) {
  const res = await request.post('/insurance_refund_plan/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 退保计划
 */
export async function delInsuranceRefundPlan(params) {
  const res = await request.post('/insurance_refund_plan/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 退保计划
 */
export async function insuranceRefundPlanDone(params) {
  const res = await request.post('/insurance_refund_plan/done', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 退保 - 退保给司机
 */
export async function pageInsuranceRefundToDriver(params) {
  const res = await request.post(
    '/insurance_refund/getWatingPayToDriverList',
    params
  );
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 退保 - 退保给司机
 */
export async function doneInsuranceRefundToDriver(params) {
  const res = await request.post('/insurance_refund/payToDriver', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 获取车辆利润指标
 */
export async function getVehicleDetail(params) {
  const res = await request.post('/vehicle/getById', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 出单表待审核 - 退回
 */
export async function setTradeStatus(params) {
  const res = await request.post('/trade/setStatus', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 账单录入
 */
export async function updateBill(params) {
  const res = await request.post('/bill/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 收支分类 添加编辑
 */
export async function updateCompanyIncomeExpenseCate(params) {
  const res = await request.post('company_income_expense_cate/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 收支分类 列表
 */
export async function pageCompanyIncomeExpenseCate(params) {
  const res = await request.post('company_income_expense_cate/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 收支分类 列表
 */
export async function pageCompanyIncomeExpenseCateTree(params) {
  const res = await request.post(
    'company_income_expense_cate/getTreeList',
    params
  );
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 收支分类 删除
 */
export async function removeCompanyIncomeExpenseCate(params) {
  const res = await request.post('company_income_expense_cate/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 手动录入的收支 添加编辑
 */
export async function updateCompanyIncomeExpense(params) {
  const res = await request.post('company_income_expense/update', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 报表里面的读取费用列表（经过特殊计算的）
 */
export async function pageCompanyIncomeExpenssReportType(params) {
  if (params.belongs_date === null) params.belongs_date = '';
  if (params.belongs_month === null) params.belongs_month = '';
  const res = await request.post('report/getCompanyIncomeExpenseList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 手动录入的收支 列表
 */
export async function pageCompanyIncomeExpense(params) {
  if (params.belongs_date === null) params.belongs_date = '';
  if (params.belongs_month === null) params.belongs_month = '';
  const res = await request.post('company_income_expense/getList', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 手动录入的收支 删除
 */
export async function removeCompanyIncomeExpense(params) {
  const res = await request.post('company_income_expense/del', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 手动录入的收支 审核
 */
export async function setCompanyIncomeExpenseStatus(params) {
  const res = await request.post('company_income_expense/setStatus', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 手动录入的收支 审核
 */
export async function passCompanyIncomeExpense(params) {
  const res = await request.post('company_income_expense/pass', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 手动录入的收支 审核
 */
export async function rejectCompanyIncomeExpense(params) {
  const res = await request.post('company_income_expense/reject', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
/**
 * 利润报表
 */
export async function getCompanyProfit(params) {
  if (params.belongs_month === null) params.belongs_month = '';
  const res = await request.post('report/getProfit', params);
  if (res.data.code === 20000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data));
}
